//
//  Calculator.h
//  Cryptarithmetic
//
//  Created by Derivery Guillaume on 4/23/13.
//  Copyright (c) 2013 Derivery Guillaume. All rights reserved.
//

#ifndef __Cryptarithmetic__Calculator__
#define __Cryptarithmetic__Calculator__

#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <stdlib.h> 

class Calculator
{
 private:
    std::vector<std::string> _args;
    std::vector<std::vector<char*> > _numbers;
    std::map<char, char>      _characterAssigned;
    std::map<char, char>::iterator      _currentIt;
    std::map<char, char>::iterator      _lastIt;
    bool _found;
    std::string *firstResult_;

private:
    int getNbr(const std::vector<char*> &str);
    bool assignDefaultValueToEachCharacter();
    void setNewNumbers();
    bool isItGood();
    bool changeCharacters();
    int addStrings();
    bool checkResult();
    bool checkDuplicateNumbers();
    unsigned int getPadding();
    std::string *getResultToDisplay();

 public:
    ~Calculator();
    Calculator(std::vector<std::string> const );
    bool calculation();
    void printArgs();
    void printResult();
    std::string *getFirstResult();


};

#endif /* defined(__Cryptarithmetic__Calculator__) */
